﻿#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion

namespace GeneralClasses
{
    public class AlgorithmHelper
    {
        #region ScheduleData

        /// <summary>
        /// Postconditions: Returns a completed ScheduleData to pass to the algorithm.
        /// </summary>
        public ScheduleData CreateScheduleData(DateTime startDate, int numDays)
        {
            ScheduleData scheduleData = new ScheduleData();

            //Get StartDate from the value entered in frmCreateSchedule.cs
            scheduleData.StartDate = startDate;

            //Get NumDays from the value entered in frmCreateSchedule.cs
            scheduleData.NumDays = numDays;

            //Get all the Departments from the database.
            scheduleData.Departments = Department.loadAllDepartments();

            DateTime endDate = startDate.AddDays(numDays);
            scheduleData.Shifts = Shift.loadAllShiftsWithin(startDate, endDate);

            //Get all the Nurses from the database.
            scheduleData.Persons = Person.loadAllActiveNurses();

            return scheduleData;
        }

        /// <summary>
        /// Postconditions: Returns a completed ScheduleData to pass to the algorithm.
        /// </summary>
        public ScheduleData CreateScheduleData(Schedule schedule)
        {
            ScheduleData scheduleData = new ScheduleData();

            //Get StartDate from the value entered in frmCreateSchedule.cs
            scheduleData.StartDate = schedule.StartDate;

            //Get NumDays from the value entered in frmCreateSchedule.cs
            scheduleData.NumDays = schedule.Days.Count;

            //Get all the Departments from the database.
            scheduleData.Departments = schedule.DepartmentMasterList;//Department.loadAllDepartments();

            DateTime endDate = schedule.EndDate;
            scheduleData.Shifts = schedule.ShiftMasterList;

            //Get all the Nurses from the database.
            scheduleData.Persons = Person.loadAllActiveNurses();

            return scheduleData;
        }

        #endregion
    }
}
